package com.lanou.moving.view;

import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.PopupWindow;
import android.widget.TextView;

import com.lanou.moving.R;

/**
 * Created by 刘琪 on 15/11/6.
 */
public class CDSPopupWindow extends PopupWindow {

    private View view;
    private TextView collection_tv, download_tv, share_tv;
    private ImageView rankingListBackground;
    public CDSPopupWindow(Context context, View view, View.OnClickListener onClickListener, ImageView background) {
        super(context);
        this.view = view;
        rankingListBackground = background;
        collection_tv = (TextView) view.findViewById(R.id.layout_song_collection);
        download_tv = (TextView) view.findViewById(R.id.layout_song_download);
        share_tv = (TextView) view.findViewById(R.id.layout_song_share);

        collection_tv.setOnClickListener(onClickListener);
        download_tv.setOnClickListener(onClickListener);
        share_tv.setOnClickListener(onClickListener);

        //设置SelectPopupWindow的View
        this.setContentView(view);
        //设置SelectPopupWindow弹出窗体的宽
        this.setWidth(200);
        //设置SelectPopupWindow弹出窗体的高
        this.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
        //设置SelectPopupWindow弹出窗体可点击
        this.setFocusable(true);
        ColorDrawable dw = new ColorDrawable(0x00000000);
        this.setBackgroundDrawable(dw);
        this.setOnDismissListener(new OnDismissListener() {
            @Override
            public void onDismiss() {
                rankingListBackground.setVisibility(View.GONE);
            }
        });

    }
}
